package com.longge;

import java.util.TreeSet;

public class SmallestInfiniteSet {

    TreeSet<Integer> set;

    public SmallestInfiniteSet() {

        set = new TreeSet<>();
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            set.add(i + 1);
        }
    }

    public int popSmallest() {
        return set.pollFirst();

    }

    public void addBack(int num) {
        set.add(num);
    }
}
